const db = require('../../../libs/db.config');

module.exports = async (data) => {
    // const searchSQL = `SELECT * FROM user WHERE userName = "${username}"`;
    const searchSQL = 'select forum.content,forum.date,forum.postID,forum.title,user.userName,userinfo.photo from forum inner join user on forum.userID = user.userID inner join userinfo on user.userID = userinfo.userID WHERE forum.title LIKE ?';
    let params = '%' + data + '%'
    return await db.query(searchSQL, [params]);
};
